package felix.rule.module.filter;

import felix.rule.api.NodeConfiguration;
import lombok.Data;

@Data
public class TJsSwitchNodeConfiguration implements NodeConfiguration<TJsSwitchNodeConfiguration> {

    private String jsScript;

    @Override
    public TJsSwitchNodeConfiguration defaultConfiguration() {
        TJsSwitchNodeConfiguration configuration = new TJsSwitchNodeConfiguration();
        configuration.setJsScript("function nextRelation(metadata, msg) {\n" +
                "    return ['one','nine'];\n" +
                "}\n" +
                "if(msgType === 'POST_TELEMETRY_REQUEST') {\n" +
                "    return ['two'];\n" +
                "}\n" +
                "return nextRelation(metadata, msg);");
        return configuration;
    }
}
